package com.ruoyi.depot.domain;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import com.ruoyi.commodity.domain.ProductCustomQualityItem;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;

/**
 * 品检详细表
 * @TableName tb_quality_inspection_detail
 */
@TableName(value ="tb_quality_inspection_detail")
@Data
public class QualityInspectionDetail implements Serializable {
    /**
     * 质检明细ID
     */
    @TableId(value = "detail_id", type = IdType.AUTO)
    private String detailId;

    /**
     * 收货产品明细ID
     */
    @TableField(exist = false)
    private String receiptProductId;

    /**
     * 质检ID，关联品检主表
     */
    @TableField(value = "inspection_id")
    private String inspectionId;

    /**
     * 产品ID
     */
    @TableField(value = "product_id")
    private Long productId;

    /**
     * 产品名称
     */
    @TableField(value = "product_name")
    private String productName;

    /**
     * 质检数量
     */
    @TableField(value = "inspected_quantity")
    private Integer inspectedQuantity;

    /**
     * 次品数量
     */
    @TableField(value = "defective_quantity")
    private Integer defectiveQuantity;

    /**
     * 良品数量
     */
    @TableField(value = "pass_quantity")
    private Integer passQuantity;

    /**
     * 质检方式(0代表抽检，1代表全检，2代表免检)
     */
    @TableField(value = "inspection_type")
    private String inspectionType;

    /**
     * 抽检比例
     */
    @TableField(value = "sampling_ratio")
    private BigDecimal samplingRatio;

    /**
     * 抽检数量
     */
    @TableField(value = "sampling_quantity")
    private Integer samplingQuantity;

    /**
     * 抽检合格率
     */
    @TableField(value = "sampling_pass_rate")
    private BigDecimal samplingPassRate;

    /**
     * 不良类型(用数字表示：尺寸不符等 可以先忽略)
     */
    @TableField(value = "defect_type")
    private Integer defectType;

    /**
     * 不良描述
     */
    @TableField(value = "defect_description")
    private String defectDescription;

    /**
     * 创建时间
     */
    @TableField(value = "created_at")
    private Date createdAt;

    /**
     * 更新时间
     */
    @TableField(value = "updated_at")
    private Date updatedAt;

    /**
     * 备注
     */
    @TableField(value = "remark")
    private String remark;

    /** 删除状态(0：正常  1：已删除 */
    @TableField(value = "delete_status")
    @TableLogic
    private Integer deleteStatus;

    /** gtin */
    @TableField(value = "gtin")
    private String gtin;

    /** gtins */
    @TableField(exist = false)
    private List<String> gtins;

    /** 仓库id */
    @TableField(exist = false)
    private Long warehouseId;

    /** 产品sku */
    @TableField(exist = false)
    private String sku;


    /** 产品质检信息 */
    @TableField(exist = false)
    private List<ProductCustomQualityItem> qualityItems;

    /** 产品质检图片 */
    @TableField(exist = false)
    private List<String> imagesPath;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        QualityInspectionDetail other = (QualityInspectionDetail) that;
        return (this.getDetailId() == null ? other.getDetailId() == null : this.getDetailId().equals(other.getDetailId()))
            && (this.getInspectionId() == null ? other.getInspectionId() == null : this.getInspectionId().equals(other.getInspectionId()))
            && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
            && (this.getProductName() == null ? other.getProductName() == null : this.getProductName().equals(other.getProductName()))
            && (this.getInspectedQuantity() == null ? other.getInspectedQuantity() == null : this.getInspectedQuantity().equals(other.getInspectedQuantity()))
            && (this.getDefectiveQuantity() == null ? other.getDefectiveQuantity() == null : this.getDefectiveQuantity().equals(other.getDefectiveQuantity()))
            && (this.getPassQuantity() == null ? other.getPassQuantity() == null : this.getPassQuantity().equals(other.getPassQuantity()))
            && (this.getInspectionType() == null ? other.getInspectionType() == null : this.getInspectionType().equals(other.getInspectionType()))
            && (this.getSamplingRatio() == null ? other.getSamplingRatio() == null : this.getSamplingRatio().equals(other.getSamplingRatio()))
            && (this.getSamplingQuantity() == null ? other.getSamplingQuantity() == null : this.getSamplingQuantity().equals(other.getSamplingQuantity()))
            && (this.getSamplingPassRate() == null ? other.getSamplingPassRate() == null : this.getSamplingPassRate().equals(other.getSamplingPassRate()))
            && (this.getDefectType() == null ? other.getDefectType() == null : this.getDefectType().equals(other.getDefectType()))
            && (this.getDefectDescription() == null ? other.getDefectDescription() == null : this.getDefectDescription().equals(other.getDefectDescription()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
            && (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getDetailId() == null) ? 0 : getDetailId().hashCode());
        result = prime * result + ((getInspectionId() == null) ? 0 : getInspectionId().hashCode());
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getProductName() == null) ? 0 : getProductName().hashCode());
        result = prime * result + ((getInspectedQuantity() == null) ? 0 : getInspectedQuantity().hashCode());
        result = prime * result + ((getDefectiveQuantity() == null) ? 0 : getDefectiveQuantity().hashCode());
        result = prime * result + ((getPassQuantity() == null) ? 0 : getPassQuantity().hashCode());
        result = prime * result + ((getInspectionType() == null) ? 0 : getInspectionType().hashCode());
        result = prime * result + ((getSamplingRatio() == null) ? 0 : getSamplingRatio().hashCode());
        result = prime * result + ((getSamplingQuantity() == null) ? 0 : getSamplingQuantity().hashCode());
        result = prime * result + ((getSamplingPassRate() == null) ? 0 : getSamplingPassRate().hashCode());
        result = prime * result + ((getDefectType() == null) ? 0 : getDefectType().hashCode());
        result = prime * result + ((getDefectDescription() == null) ? 0 : getDefectDescription().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", detailId=").append(detailId);
        sb.append(", inspectionId=").append(inspectionId);
        sb.append(", productId=").append(productId);
        sb.append(", productName=").append(productName);
        sb.append(", inspectedQuantity=").append(inspectedQuantity);
        sb.append(", defectiveQuantity=").append(defectiveQuantity);
        sb.append(", passQuantity=").append(passQuantity);
        sb.append(", inspectionType=").append(inspectionType);
        sb.append(", samplingRatio=").append(samplingRatio);
        sb.append(", samplingQuantity=").append(samplingQuantity);
        sb.append(", samplingPassRate=").append(samplingPassRate);
        sb.append(", defectType=").append(defectType);
        sb.append(", defectDescription=").append(defectDescription);
        sb.append(", createdAt=").append(createdAt);
        sb.append(", updatedAt=").append(updatedAt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}